package com.itqf.web;

import com.itqf.dao.BookDao;
import com.itqf.entity.Book;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/9/21
 * @Time: 上午11:33
 */
@WebServlet("/findBook")
public class BookController extends HttpServlet {


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Book> list = BookDao.getBookList();
        req.setAttribute("books",list);

        req.getRequestDispatcher("index.jsp").forward(req,resp);
    }
}
